package org.jeecg.enums.common;

/**
 * 收款方式 - 内置
 */
public enum PayTypeEnum {
    PAY_METHOD_XIANJIN(1, "现金支付"),
    PAY_METHOD_ZHUANZHANG(2, "转账支付"),
//    PAY_METHOD_WEIXINPAYOFFLINE(3, "扫码支付(微信)"),
//    PAY_METHOD_ALIPAYOFFLINE(4, "扫码支付(支付宝)"),
    PAY_METHOD_POS(5, "刷卡支付"),
    PAY_METHOD_WEIXINPAY(8, "微信"),
    PAY_METHOD_ALIPAY(9, "支付宝"),
    PAY_METHOD_OTHER(11,"其他"),
    ;

    private Integer code;
    private String desc;

    PayTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return  "";
        PayTypeEnum[] enums = values();
        for (PayTypeEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        PayTypeEnum[] enums = values();
        for (PayTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
